package org.dromara.common.core.domain.model

import jakarta.validation.constraints.NotBlank
import java.io.Serial
import java.io.Serializable


/**
 * 用户登录对象
 *
 *@author LikeYouDo
 *@date 2025/1/3 11:08
 */
open class LoginBody(
    /**
     * 客户端id
     */
    @NotBlank(message = "{auth.clientid.not.blank}")
    var clientId: String = "",

    /**
     * 授权类型
     */
    @NotBlank(message = "{auth.grant.type.not.blank}")
    var grantType: String = "",

    /**
     * 租户ID
     */

    var tenantId: String? = null,

    /**
     * 验证码
     */

    var code: String? = null,

    /**
     * 唯一标识
     */

    var uuid: String? = null,
) : Serializable {
    companion object {
        @Serial
        private val serialVersionUID = 1L
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is LoginBody) return false

        if (clientId != other.clientId) return false
        if (grantType != other.grantType) return false
        if (tenantId != other.tenantId) return false
        if (code != other.code) return false
        if (uuid != other.uuid) return false

        return true
    }

    override fun hashCode(): Int {
        var result = clientId.hashCode()
        result = 31 * result + grantType.hashCode()
        result = 31 * result + (tenantId?.hashCode() ?: 0)
        result = 31 * result + (code?.hashCode() ?: 0)
        result = 31 * result + (uuid?.hashCode() ?: 0)
        return result
    }


}
